import {FavorFolderStatus, parseFavorFolderStatus} from "./FavorFolderStatus.ts";


export enum FavorFolderType {
    // 公开的
    PUBLIC = 1,
    // 私有的
    PRIVATE = 0,
    // 未知
    DEFAULT = 2,
}

export interface FavorFolder {
    id: number
    type: FavorFolderType
    name: string
    status: FavorFolderStatus[]
    length: number
    defaultFolder: boolean
}

export const buildFavorFolder = (data: any) => {
    return {
        id: data.id,
        type: data.type,
        name: data.name,
        status: parseFavorFolderStatus(data.bytes),
        length: data.length,
        defaultFolder: !!data['default']
    } as FavorFolder
}